package com.scilvet.reportcomposer.node;

import com.scilvet.reportcomposer.account.Amount;

public class Sum extends BinaryExpression {

	public Sum(Node leftNode, Node rightNode) {
		super(leftNode, rightNode);
	}

	@Override
	public Amount getValue() {
		
		Amount leftAmount = leftNode.getValue();
		Amount rightAmount = rightNode.getValue();
		
		return leftAmount.add(rightAmount);
	}
	
	@Override
	public String toString() {
		return "(" + leftNode.toString() + " + " + rightNode.toString() + ")";
	}
	
	public String printValues() {
		return "(" + leftNode.printValues() + " + " + rightNode.printValues() + ")";
	}
}
